package com.sky.mapper;

import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.OrderDetail;
import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    /**
     * 动态查询购物车
     * @param shoppingCart
     * @return
     */
    List<ShoppingCart> list(ShoppingCart shoppingCart);

    void updateNumberBySCart(ShoppingCart cart);


    void insert(ShoppingCart shoppingCart);
    @Select("SELECT * FROM shopping_cart where user_id= #{userId}")
    List<ShoppingCart> GetByUserId(Long userId);
    @Delete("delete from shopping_cart where user_id= #{userId}")
    void deleteByUserId(Long userId);


    void deleteOne(ShoppingCart shoppingCart);

    void insertBatches(List<ShoppingCart> orderDetailList);
}
